package com.practice.dao.daoImpl;

import cn.hutool.core.convert.Convert;
import cn.hutool.core.lang.TypeReference;
import com.practice.dao.DeptDao;
import com.practice.dao.EmpDao;
import com.practice.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author:高杰领
 * @date:2021/11/19 14:28
 * @description:Deptdao实现类
 * @version:1.0
 **/
@Repository
public class DeptDaoImpl implements DeptDao {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Override
    public List<Dept> selectAllDeptno() {
        String sql = " select * from dept ";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        List<Dept> depts = Convert.convert(new TypeReference<List<Dept>>() {
        }, list);
        return depts;
    }
}
